feat: add multivariate test case with keyed variants#57
Merged
Conversation
The existing multivariate cases have no variant keys, so nothing in the corpus exercises key passthrough. Add a case where the variants carry stable keys and the identity is bucketed into a named variant, asserting its key is returned as `variant`.
Member
Author
|
/gemini review |
gagantrivedi
added a commit
to Flagsmith/flagsmith-engine
that referenced
this pull request
Jun 8, 2026
Every flag result now carries a `variant` field, mirroring OpenFeature's `ResolutionDetails.variant` (always present, nullable): - the variant's key when a named multivariate variant is selected, - `"control"` when an identity falls in the control bucket (the leftover allocation that resolves to the feature's default value); the control is not a multivariate option, so the engine synthesises this key, - `null` otherwise (standard features, unkeyed variants, or evaluation without an identity, where nothing is bucketed). Selection logic, hashing and ordering are unchanged. The behaviour is covered by the shared engine-test-data corpus; the submodule is pinned at the keyed-variant branch (Flagsmith/engine-test-data#57) until released, to be re-pinned to the tag.
Zaimwa9
approved these changes
Jun 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
Follow-up to #56. Every existing multivariate case in the corpus has variants without keys, so although the result schema now carries
variant, nothing here exercises key passthrough — engines could fail to return a selected variant's key and still pass the corpus.This adds one case where the variants carry stable keys and the identity is bucketed into a named variant, asserting its key is returned as
variant:The control bucket (
variant: "control") andnullcases are already covered by #56. The expected result was generated by running the engine, so it matches the real hashing/selection.